{% extends 'layout.html' %}
{% block content %}

<div class="container">
    <div style="margin-bottom: 10px">
        <!--    上下间距-->
        <!--    target="_blank" 新页面打开-->
        <a class="btn btn-primary" href="user/add/form" target="_blank">
            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
            新增人员名单
        </a>
    </div>

    <div class=" panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading">人员列表</div>
        <!-- Table -->
        <table class="table table-bordered "   >
            <thead >
            <tr >
                <th>ID</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th>工资</th>
                <th>部门</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody >
            {% for item in list %}
            <tr>
                <td>{{ item.id }}</td>
                <td>{{ item.name }}</td>
                <td>{{ item.age}}</td>
<!--                模板中方法不能加括号，规定-->
                <td>{{ item.get_gender_display}}</td>
                <td>{{ item.salary}}</td>
                <td>{{ item.depart.title}}</td>
                <td>{{ item.creat_time|date:"Y-m-d"}}</td>
                <td>
                    <a class="btn btn-success btn-xs" href="/user/{{item.id}}/edit">编辑</a>
                    <a class="btn btn-danger btn-xs" href="/user/{{item.id}}/delete">删除</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>

</div>

{% endblock %}